package cn.jit.ssm.demo;

import cn.jit.ssm.constant.LoginState;
import cn.jit.ssm.support.JSONReturn;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;

/**
 * 测试Jackson的json转换过程
 * @author: Cecurio
 * @create: 2017-12-06 19:53
 **/
public class Demo1 {
    public static void main(String[] args) {
        ObjectWriter ow = new ObjectMapper().writer();

        String json = null;
        try {
            json = ow.writeValueAsString(JSONReturn.buildFailure(LoginState.UNLOGIN.getMsg()));
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        System.out.println(json);
    }
}
